package com.thp.bigdata.rjoin.findFriends;

import java.io.IOException;


import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

public class CommonFriendsRun2 {
	public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
		Configuration conf = new Configuration();
		
		conf.set("mapreduce.framework.name", "local");
		conf.set("fs.defaultFS", "file:///");
		
		
		Job job = Job.getInstance(conf);
		
		job.setJar("f:/rjoin.jar");
		
		
		job.setOutputKeyClass(Text.class);
		job.setOutputValueClass(Text.class);
		
		job.setMapperClass(CommonFriendsStepTwoMapper.class);
		job.setReducerClass(CommonFriendsStepTwoReducer.class);
		
		
		FileInputFormat.setInputPaths(job, new Path("f:/commonFriends/output_1"));
		FileOutputFormat.setOutputPath(job, new Path("f:/commonFriends/output_2"));
		
		
		boolean res = job.waitForCompletion(true);
		
		System.exit(res ? 0 : 1);
		
	}
}
